﻿using System;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Auto_Buy
{
    public class ResponseBody
    {
        public static List<T> GetGridData<T>(string response)
        {
            var obj = JsonConvert.DeserializeObject<dynamic>(response);
            if (obj.d == null)
            {
                return null;
            }
            var resData = JsonConvert.DeserializeObject<dynamic>(obj.d.ToString());
            var gridstr = resData.grid.ToString();
            return JsonConvert.DeserializeObject<List<T>>(gridstr);
        }

    }
}
